﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Mahanet.Abyss.PathCalculation
{
	public class Coordinate2D
	{
		#region C'tor

		public Coordinate2D(double x, double y)
		{
			this.X = x;
			this.Y = y;
		}

		#endregion

		#region Public Properties

		public double X { get; private set; }
		public double Y { get; private set; }

		#endregion

		#region Public Methods

		public double DistanceTo(Coordinate2D other)
		{
			double xDist = X - other.X;
			double yDist = Y - other.Y;
			return Math.Sqrt(xDist * xDist + yDist * yDist);
		}

		public override string ToString()
		{
			return string.Format("({0}, {1})", X, Y);
		}

		public static Vector2D operator -(Coordinate2D a, Coordinate2D b)
		{
			return new Vector2D(b, a);
		}

		#endregion
	}
}
